package test

import config.MyFile
import org.apache.commons.io.FileUtils
import scala.jdk.CollectionConverters._

object test1 extends MyFile{

  def main(args: Array[String]): Unit = {
    deal
  }

  def test = {

    val f = "D:\\紫花苜蓿数据库\\block".listFile.flatMap{x=>
      val line =x.readLines.filter(!_.startsWith("#")).map(_.split("\t")).map(y=>y.head.split('.').init.mkString(".") -> y(1).split('.').init.mkString("."))
      line ++ line.map(y=>y._2 -> y._1)
    }

    f.groupBy(_._1).foreach{x=>

      println(x._1 + "\t" + x._2.map(_._2).distinct.mkString(","))

    }

  }

  def deal = {
   val row=   "D:\\紫花苜蓿数据库\\collinearity/Zmno.Msae.anchors".readLines.map{x=>
      x.replaceAll("MsaT","MsaG")
    }

    FileUtils.writeLines("D:\\紫花苜蓿数据库\\collinearity/Zmno.Msae.anchors".toFile,row.asJava)
  }
}
